package com.cb.domain.service.excelWork.formWork;

import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;

import com.cb.domain.model.order.Policy;
import com.cb.domain.service.excelWork.POLICY_TYPE;
import com.cb.domain.service.excelWork.WORK_TYPE;

public abstract class BaseFormWorker implements IFormWorker {
	protected Document doc=DocumentHelper.createDocument();
	protected Policy policy;
	protected abstract void formatObj(Element root);
	@Override
	public String doWork(Policy policy, WORK_TYPE wtype, POLICY_TYPE ptype) {
		// TODO Auto-generated method stub
		Element root = doc.addElement("PolicyList");
		root.addAttribute("username", "mysql");
		root.addAttribute("password", "mysql");
		root.addAttribute("type", ptype.toString());
		root.addAttribute("execType", wtype.toString());
		this.policy=policy;
		formatObj(root);
		return doc.asXML();
	}
}
